package daoIpmt;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import beans.PersonInformation;
import dao.SearchByUsername;
import utils.DataSourceUtils;

public class SearchByUsernameIpmt implements SearchByUsername{

	@Override
	public List<PersonInformation> searchByUsername(String username) {
		String sql="select*from personinformation where username like '%"+username+"%'";
		QueryRunner que = new QueryRunner(DataSourceUtils.getDataSource());
		try {
			return que.query(sql, new BeanListHandler<PersonInformation>(PersonInformation.class));
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
	
}
